package library.library.service.impl;

import library.library.dao.AdministratorsDao;
import library.library.model.Administrators;
import library.library.service.AdministratorsService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import util.page1.PageUtils;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * Created by MondaDev01 on 2017/11/2.
 */
@Service
@Transactional
public class AdministratorsServiceImpl implements AdministratorsService {

    @Resource
    private AdministratorsDao administratorsDao;
    public int AddAdministrators(String name, String password, Integer sex) {

        Administrators administrators1 = administratorsDao.get(sex);

        /*return administratorsDao.AddAdministrators(name, password, sex);*/
        Administrators administrators = new Administrators();
        administrators.setName(name);
        administrators.setPassword(password);
        administrators.setSex(sex);
        return administratorsDao.add(administrators);
    }

    public PageUtils<Administrators> page(String name, Integer sex, Date qDate, Date hDate, Integer pageIndex, Integer pageSize) {
        return administratorsDao.page(name, sex, qDate, hDate, pageIndex, pageSize);
    }


}
